<template>
  <div class="tm-select">
    <el-select v-model="currValue" clearable v-on="$listeners">
      <el-option v-for="(item,index) in data" :key="index+'_'+item[valueKey]" :label="item[labelKey]" :value="item[valueKey]"/>
    </el-select>
  </div>
</template>

<script>
export default {
  name: 'tm-select',
  cnName: 'tm-select',
  props: {
    value: [String, Number, Boolean],
    data: Array,
    valueKey: {
      type: String,
      default: 'value'
    },
    labelKey: {
      type: String,
      default: 'label'
    }
  },
  data() {
    return {}
  },
  computed: {
    currValue: {
      get() {
        return this.value
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  methods: {}
}
</script>

<style lang="less" scoped>
.tm-select {
}
</style>
